package com.deyuanyun.pic.ctrl.controller.vo.exinsp;

import com.deyuanyun.pic.common.util.format.DateFormat;
import com.deyuanyun.pic.ctrl.domain.ExinspAnodesbed;
import com.deyuanyun.pic.ctrl.enumeration.AbnormalEnum;
import com.deyuanyun.pic.pipe.controller.vo.BaseVOUtil;
import com.deyuanyun.pic.settings.support.biz.PipeLineUtil;
import com.github.pagehelper.Page;

import java.math.BigDecimal;

/**
 * 辅助阳极地床检测记录 视图对象
 *
 * @author huanglw
 * @date  2016-9-8
 *
 * History: [修改人][时间][修改描述]
 */
public class ExinspAnodesbedVO extends ExinspBaseVO<ExinspAnodesbed> {

    // 设备编号(自定义编号)
    private String customNumber;
    // 测试桩编号
    private String testStationNum;
    // 所属场站阀室
    private String pipeValveroomName;
    // 辅助阳极地床接地电阻（Ω）
    private BigDecimal groundingResistance;
    // 维护记录
    private String maintenanceRecord;
     // 异常记录
    private String faultRecord;
    // 是否有异常(YES、NO)
    private String abnormal;
    // 处理措施
    private String treatmentMeasures;
    // 检测日期
    private String detectiongDete;

    public String getCustomNumber() {
        return customNumber;
    }

    public void setCustomNumber(String customNumber) {
        this.customNumber = customNumber;
    }

    public String getTestStationNum() {
        return testStationNum;
    }

    public void setTestStationNum(String testStationNum) {
        this.testStationNum = testStationNum;
    }

    public String getPipeValveroomName() {
        return pipeValveroomName;
    }

    public void setPipeValveroomName(String pipeValveroomName) {
        this.pipeValveroomName = pipeValveroomName;
    }

    public BigDecimal getGroundingResistance() {
        return groundingResistance;
    }

    public void setGroundingResistance(BigDecimal groundingResistance) {
        this.groundingResistance = groundingResistance;
    }

    public String getMaintenanceRecord() {
        return maintenanceRecord;
    }

    public void setMaintenanceRecord(String maintenanceRecord) {
        this.maintenanceRecord = maintenanceRecord;
    }

    public String getFaultRecord() {
        return faultRecord;
    }

    public void setFaultRecord(String faultRecord) {
        this.faultRecord = faultRecord;
    }

    public String getAbnormal() {
        return abnormal;
    }

    public void setAbnormal(String abnormal) {
        this.abnormal = abnormal;
    }

    public String getTreatmentMeasures() {
        return treatmentMeasures;
    }

    public void setTreatmentMeasures(String treatmentMeasures) {
        this.treatmentMeasures = treatmentMeasures;
    }

    public String getDetectiongDete() {
        return detectiongDete;
    }

    public void setDetectiongDete(String detectiongDete) {
        this.detectiongDete = detectiongDete;
    }

    public void fromDomain(ExinspAnodesbed domain) {

        // 设备编号(自定义编号)
        this.customNumber = domain.getCustomNumber();
        // 测试桩编号
        this.testStationNum = domain.getTestStationId();
        // 所属场站阀室
        this.pipeValveroomName = PipeLineUtil.getValveRoomName(domain.getPipeValveroomId());
        // 辅助阳极地床接地电阻（Ω）
        this.groundingResistance = domain.getGroundingResistance();
        // 维护记录
        this.maintenanceRecord = domain.getMaintenanceRecord();
        // 异常记录
        this.faultRecord = domain.getFaultRecord();
        // 是否有异常(YES、NO)
        this.abnormal = AbnormalEnum.getLabel(domain.getAbnormal());
        // 处理措施
        this.treatmentMeasures = domain.getUpdateRemark();;
        // 检测日期
        this.detectiongDete = DateFormat.format(domain.getDetectiongDete());

        super.fromDomain(domain.getId(), domain.getRecorder(), domain.getRecordTime(), domain.getRemarks());
    }

    public Page<ExinspAnodesbedVO> fromDomainList(Page<ExinspAnodesbed> domainList) {

        Page<ExinspAnodesbedVO> list = new Page<ExinspAnodesbedVO>();
        for (ExinspAnodesbed exinspAnodesbed : domainList) {
            ExinspAnodesbedVO exinspAnodesbedVO = new ExinspAnodesbedVO();
            exinspAnodesbedVO.fromDomain(exinspAnodesbed);
            list.add(exinspAnodesbedVO);
        }
        BaseVOUtil.converterPage(domainList, list);
        return list;
    }
}